/**
* Copyright 2011 Joao Miguel Pereira
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.jpereira.trainings.designpatterns.behavioral.state.appliance.state;
/**
* @author jpereira
* TODO: Find TODOs in this class and follow them
*
*/
public class StartedState implements ApplianceStateBehavior {
/* (non-Javadoc)
* @see eu.jpereira.trainings.designpatterns.behavioral.state.appliance.state.ApplianceStateBehavior#getState()
*/
@Override
public ApplianceState getState() {
//TODO: Return the correct ApplianceState
return ApplianceState.STARTED;
}
/* (non-Javadoc)
* @see eu.jpereira.trainings.designpatterns.behavioral.state.appliance.state.ApplianceStateBehavior#start()
*/
@Override
public ApplianceStateBehavior start() {
// Already started
return this;
}
/* (non-Javadoc)
* @see eu.jpereira.trainings.designpatterns.behavioral.state.appliance.state.ApplianceStateBehavior#stop()
*/
@Override
public ApplianceStateBehavior stop() {
// Can go to Stop state
return ApplianceState.STOPPED.getStateBehavior();
}
/* (non-Javadoc)
* @see eu.jpereira.trainings.designpatterns.behavioral.state.appliance.state.ApplianceStateBehavior#turnOn()
*/
@Override
public ApplianceStateBehavior turnOn() {
//Can't turn off when started
return this;
}
/* (non-Javadoc)
* @see eu.jpereira.trainings.designpatterns.behavioral.state.appliance.state.ApplianceStateBehavior#turnOff()
*/
@Override
public ApplianceStateBehavior turnOff() {
// Can't turn off on STARTED
return this;
}
}